org.eclipse.vtp.framework.engine.support
Class AbstractSessionContext

java.lang.Object
  extended by org.eclipse.vtp.framework.engine.support.AbstractReporter
      extended by org.eclipse.vtp.framework.engine.support.AbstractLogger
          extended by org.eclipse.vtp.framework.engine.support.AbstractContext
              extended by org.eclipse.vtp.framework.engine.support.AbstractSessionContext
All Implemented Interfaces:
IContext, ILogger, IProcessContext, IReporter, ISessionContext
Direct Known Subclasses:
Session.Context

public abstract class AbstractSessionContext
extends AbstractContext
implements ISessionContext

A support implementation of the ISessionContext interface.

Author:
Lonnie Pryor

Field Summary
protected  ISessionDescriptor descriptor
          The session descriptor.
protected  IProcessContext processContext
          The context of the process that created this session.
protected  java.util.Set providedServiceIdentifiers
          The service identifiers provided by the descriptor.
protected static java.util.Set RESERVED_SERVICE_IDENTIFIERS
          The service identifiers that will return this context.
 
Fields inherited from interface org.eclipse.vtp.framework.core.IReporter
SEVERITY_DEBUG, SEVERITY_ERROR, SEVERITY_INFO, SEVERITY_WARN
 
Constructor Summary
protected AbstractSessionContext(IProcessContext processContext, ISessionDescriptor descriptor)
          Creates a new AbstractSessionContext.
 
Method Summary
 void clearAttribute(java.lang.String attributeName)
          Clears the value of a session-level attribute.
protected  void doReport(int severity, java.lang.String[] categories, java.lang.String message, java.util.Dictionary properties)
          Implementation of report creation and publication after checking the severity.
 java.lang.Object getAttribute(java.lang.String attributeName)
          Returns the value of a session-level attribute with the specified name or null if no such attribute exists.
 java.lang.String[] getAttributeNames()
          Returns the names of all the session-level attributes currently registered.
 java.lang.String getProcessID()
          Returns the ID of this process.
 java.lang.Object getProperty(java.lang.String propertyName)
          Returns the value of the process-level configuration property with the specified name or null if no such property exists.
 java.lang.String getSessionID()
          Returns the ID of the current session.
 boolean isSeverityEnabled(int severity)
          Returns true if the specified severity level is enabled.
 java.lang.Class loadClass(java.lang.String className)
          Loads a class visible to the process.
protected  java.lang.Object[] lookupAllInheritedServices(java.lang.String identifier)
          Returns all the services registered under the specified identifier in any ancestor registry or null if no such services can be found.
protected  java.lang.Object[] lookupAllLocalServices(java.lang.String identifier)
          Returns all the services registered under the specified identifier in this registry or null if no such services can be found.
protected  java.lang.Object lookupInheritedService(java.lang.String identifier)
          Returns a service registered under the specified identifier in any ancestor registry or null if no such service exists.
protected  java.lang.Object lookupLocalService(java.lang.String identifier)
          Returns a service registered under the specified identifier in this registry or null if no such service exists.
protected  java.lang.Object lookupReservedService(java.lang.String identifier)
          Returns the reserved service if the specified identifier is one of the reserved identifiers or null if these conditions are not met.
 void setAttribute(java.lang.String attributeName, java.lang.Object attributeValue)
          Sets the value of a session-level attribute or clears it if the supplied value is null.
 
Methods inherited from class org.eclipse.vtp.framework.engine.support.AbstractContext
lookup, lookupAll
 
Methods inherited from class org.eclipse.vtp.framework.engine.support.AbstractLogger
debug, debug, debug, debug, doLog, error, error, error, error, info, info, info, info, isDebugEnabled, isErrorEnabled, isInfoEnabled, isWarnEnabled, log, log, log, log, warn, warn, warn, warn
 
Methods inherited from class org.eclipse.vtp.framework.engine.support.AbstractReporter
report, report, report, report
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.eclipse.vtp.framework.core.IContext
lookup, lookupAll
 
Methods inherited from interface org.eclipse.vtp.framework.core.ILogger
debug, debug, debug, debug, error, error, error, error, info, info, info, info, isDebugEnabled, isErrorEnabled, isInfoEnabled, isWarnEnabled, log, log, log, log, warn, warn, warn, warn
 
Methods inherited from interface org.eclipse.vtp.framework.core.IReporter
report, report, report, report
 

Field Detail

RESERVED_SERVICE_IDENTIFIERS

protected static final java.util.Set RESERVED_SERVICE_IDENTIFIERS
The service identifiers that will return this context.


processContext

protected final IProcessContext processContext
The context of the process that created this session.


descriptor

protected final ISessionDescriptor descriptor
The session descriptor.


providedServiceIdentifiers

protected final java.util.Set providedServiceIdentifiers
The service identifiers provided by the descriptor.

Constructor Detail

AbstractSessionContext

protected AbstractSessionContext(IProcessContext processContext,
                                 ISessionDescriptor descriptor)
                          throws java.lang.NullPointerException
Creates a new AbstractSessionContext.

Parameters:
processContext - The context of the process that created this session.
descriptor - The session descriptor.
Throws:
java.lang.NullPointerException - If the supplied process context is null.
java.lang.NullPointerException - If the supplied descriptor is null.
Method Detail

doReport

protected void doReport(int severity,
                        java.lang.String[] categories,
                        java.lang.String message,
                        java.util.Dictionary properties)
Description copied from class: AbstractReporter
Implementation of report creation and publication after checking the severity.

Specified by:
doReport in class AbstractReporter
Parameters:
severity - The severity of the report.
categories - The categories the report pertains to or null if no catagories are related.
message - The message associated with the report or null to not include a message.
properties - The properties of the report or null if no properties are specified.

isSeverityEnabled

public boolean isSeverityEnabled(int severity)
Description copied from interface: IReporter
Returns true if the specified severity level is enabled.

Specified by:
isSeverityEnabled in interface IReporter
Parameters:
severity - The severity to check.
Returns:
True if the specified severity level is enabled.

lookupReservedService

protected java.lang.Object lookupReservedService(java.lang.String identifier)
Description copied from class: AbstractContext
Returns the reserved service if the specified identifier is one of the reserved identifiers or null if these conditions are not met.

Overrides:
lookupReservedService in class AbstractContext
Parameters:
identifier - The identifier of the service to return, will never be null.
Returns:
The reserved service if the specified identifier is one of the reserved identifiers or null if these conditions are not met.

lookupLocalService

protected java.lang.Object lookupLocalService(java.lang.String identifier)
Description copied from class: AbstractContext
Returns a service registered under the specified identifier in this registry or null if no such service exists.

Overrides:
lookupLocalService in class AbstractContext
Parameters:
identifier - The identifier of the service to return, will never be null.
Returns:
A service registered under the specified identifier in this registry or null if no such service exists.

lookupAllLocalServices

protected java.lang.Object[] lookupAllLocalServices(java.lang.String identifier)
Description copied from class: AbstractContext
Returns all the services registered under the specified identifier in this registry or null if no such services can be found.

Overrides:
lookupAllLocalServices in class AbstractContext
Parameters:
identifier - The identifier of the services to return, will never be null.
Returns:
All the services registered under the specified identifier in this registry or null if no such services can be found.

lookupInheritedService

protected java.lang.Object lookupInheritedService(java.lang.String identifier)
Description copied from class: AbstractContext
Returns a service registered under the specified identifier in any ancestor registry or null if no such service exists.

Overrides:
lookupInheritedService in class AbstractContext
Parameters:
identifier - The identifier of the service to return, will never be null.
Returns:
A service registered under the specified identifier in any ancestor registry or null if no such service exists.

lookupAllInheritedServices

protected java.lang.Object[] lookupAllInheritedServices(java.lang.String identifier)
Description copied from class: AbstractContext
Returns all the services registered under the specified identifier in any ancestor registry or null if no such services can be found.

Overrides:
lookupAllInheritedServices in class AbstractContext
Parameters:
identifier - The identifier of the services to return, will never be null.
Returns:
All the services registered under the specified identifier in any ancestor registry or null if no such services can be found.

getProcessID

public final java.lang.String getProcessID()
Description copied from interface: IProcessContext
Returns the ID of this process.

Specified by:
getProcessID in interface IProcessContext
Returns:
The ID of this process.

getProperty

public final java.lang.Object getProperty(java.lang.String propertyName)
                                   throws java.lang.NullPointerException
Description copied from interface: IProcessContext
Returns the value of the process-level configuration property with the specified name or null if no such property exists.

Specified by:
getProperty in interface IProcessContext
Parameters:
propertyName - The name of the configuration property to return.
Returns:
The value of the process-level configuration property with the specified name or null if no such property exists.
Throws:
java.lang.NullPointerException - If the supplied property name is null.

loadClass

public final java.lang.Class loadClass(java.lang.String className)
                                throws java.lang.ClassNotFoundException,
                                       java.lang.NullPointerException
Description copied from interface: IProcessContext
Loads a class visible to the process.

Specified by:
loadClass in interface IProcessContext
Parameters:
className - The name of the class to load.
Returns:
The requested class instance.
Throws:
java.lang.ClassNotFoundException - If a class with the specified name cannot be found.
java.lang.NullPointerException - If the supplied class name is null.

getSessionID

public final java.lang.String getSessionID()
Description copied from interface: ISessionContext
Returns the ID of the current session.

Specified by:
getSessionID in interface ISessionContext
Returns:
The ID of the current session.

getAttributeNames

public final java.lang.String[] getAttributeNames()
Description copied from interface: ISessionContext
Returns the names of all the session-level attributes currently registered.

Specified by:
getAttributeNames in interface ISessionContext
Returns:
The names of all the session-level attributes currently registered.

getAttribute

public final java.lang.Object getAttribute(java.lang.String attributeName)
                                    throws java.lang.NullPointerException
Description copied from interface: ISessionContext
Returns the value of a session-level attribute with the specified name or null if no such attribute exists.

Specified by:
getAttribute in interface ISessionContext
Parameters:
attributeName - The name of the session attribute to return.
Returns:
The value of a session-level attribute with the specified name or null if no such attribute exists.
Throws:
java.lang.NullPointerException - If the supplied attribute name is null.

setAttribute

public final void setAttribute(java.lang.String attributeName,
                               java.lang.Object attributeValue)
                        throws java.lang.NullPointerException
Description copied from interface: ISessionContext
Sets the value of a session-level attribute or clears it if the supplied value is null.

Specified by:
setAttribute in interface ISessionContext
Parameters:
attributeName - The name of the session attribute to set.
attributeValue - The value to set the attribute to or null to clear the attribute.
Throws:
java.lang.NullPointerException - If the supplied attribute name is null.

clearAttribute

public final void clearAttribute(java.lang.String attributeName)
                          throws java.lang.NullPointerException
Description copied from interface: ISessionContext
Clears the value of a session-level attribute.

Specified by:
clearAttribute in interface ISessionContext
Parameters:
attributeName - The name of the session attribute to clear.
Throws:
java.lang.NullPointerException - If the supplied attribute name is null.